﻿using System.ComponentModel;
using System.Xml;
using AIS2.DataAccess;
using MassIntellect;
using MassIntellect.WorkIt;

namespace AIS2
{
// ReSharper disable UnusedMember.Global
	public class DAServiceTBCMsg : WorkFrame, IDAServiceTBCMsg
// ReSharper restore UnusedMember.Global
	{
		[Serialize]
		[Description("Таймаут ожидания соединения с базой данных")]
		public int DatabaseTimeout { get; set; }

		#region IDAServiceTBCMsg Members

		[Serialize]
		public string ConnectionString { get; set; }

		public TBCMessageSystemDataContext GetContext()
		{			
			var db = new TBCMessageSystemDataContext(ConnectionString);
			db.CommandTimeout = DatabaseTimeout;
			return db;
		}

		#endregion
	}
}